import request from '@/config/axios'

// 货物资料 VO
export interface CargoInfoVO {
  id: number // 主键
  orderId: string // 订单编号
  warehouseNumber: number // 进仓件数
  productNameMode: string // 品名/型号（多个逗号分开）
  goodsNature: string // 货物类型
  specialProtection: number // 是否需要特殊防护(0-否；1-是)
  comesDangerousBag: number // 是否自带危包(0-否；1-是)
  mainOrderId: string // 主订单号
  unloadingPort: string // 目的港
  status: number // 状态
  phonenumber: string
}

// 货物资料 API
export const CargoInfoApi = {
  // 查询货物资料分页
  getCargoInfoPage: async (params: any) => {
    return await request.get({ url: `/business/cargo-info/page`, params })
  },

  sumaryCargoInfo: async (params: any) => {
    return await request.get({ url: `/business/cargo-info/sumary`, params })
  },

  // 查询货物资料详情
  getCargoInfo: async (id: number) => {
    return await request.get({ url: `/business/cargo-info/get?id=` + id })
  },

  getCreateFile: async (id: number) => {
    return await request.get({ url: `/business/cargo-info/queryCreateFile/${id}`})
  },


  // 新增货物资料
  createCargoInfo: async (data: any) => {
    return await request.post({ url: `/business/cargo-info/create`, data })
  },

  // 修改货物资料
  updateCargoInfo: async (data: any) => {
    return await request.put({ url: `/business/cargo-info/update`, data })
  },

  // 删除货物资料
  deleteCargoInfo: async (id: number) => {
    return await request.delete({ url: `/business/cargo-info/delete?id=` + id })
  },

  // 导出货物资料 Excel
  exportCargoInfo: async (params) => {
    return await request.download({ url: `/business/cargo-info/export-excel`, params })
  },

  //收货录入照片
  addReceiptInfo: async (data: any)=>{
    return await request.post({ url: `/business/cargo-info/receipt`, data })
  },

  //收货录入详情
  getReceiptInfo: async (id: number) => {
    return await request.get({ url: `/business/cargo-info/queryReceipt/${id}`})
  },

  //货物打包
  addRPackInfo: async (data: any)=>{
    return await request.post({ url: `/business/cargo-info/pack`, data })
  },

  //货物打包详情
  getPackInfo: async (id: number) => {
    return await request.get({ url: `/business/cargo-info/querypack/${id}`})
  },

  addPackCheck:async (data: any) => {
    return await request.post({ url: `/business/cargo-info/packCheck`, data})
  },

  addPlan:async (data: any) => {
    return await request.post({ url: `/business/cargo-info/addPlan`, data})
  },

  //仓库出库
  addShipmentInfo: async (data: any)=>{
    return await request.post({ url: `/business/cargo-info/shipment`, data })
  },

  //安检照片
  getShipmentInfo: async (id: number) => {
    return await request.get({ url: `/business/cargo-info/queryshipment/${id}`})
  },

  //安检
  addScenceInfo: async (data: any)=>{
    return await request.post({ url: `/business/cargo-info/scene`, data })
  },

  //报关信息
  addCustomsInfo: async (data: any)=>{
    return await request.post({ url: `/business/cargo-info/customs`, data })
  },

  //交单
  addHandUpInfo: async (data: any)=>{
    return await request.post({ url: `/business/cargo-info/handUp`, data })
  },

  //航空动态
  addAirWayInfo: async (data: any)=>{
    return await request.post({ url: `/business/cargo-info/airway`, data })
  },

  //报关信息详情
  getCustomsInfo: async (id: number) => {
    return await request.get({ url: `/business/cargo-info/querycustoms/${id}`})
  },

  //到港
  addArrivalInfo: async (data:any) =>{
    return await request.post({ url: `/business/cargo-info/arrival`, data })
  },

  //获取图片资源
  getCargoFiles: async (id: number) => {
    return await request.get({ url: `/business/cargo-info/queryFile/${id}`})
  },

  //待发货打回
  addShippedBack: async (data:any) =>{
    return await request.post({ url: `/business/cargo-info/shippedBack`, data })
  },

  queryCityCode: async (query:String)=>{
    return await request.get({url:'/business/citycode/list', params:{code: query}})
  }
}